Conditions | 1 |
Paths | 1 |
Total Lines | 153 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | module.exports = function (grunt) { |
||
2 | require('load-grunt-tasks')(grunt); |
||
3 | require('time-grunt')(grunt); |
||
4 | |||
5 | grunt.initConfig({ |
||
6 | dirs: { |
||
7 | source: 'app/Resources/assets', |
||
8 | destination: 'web/assets' |
||
9 | }, |
||
10 | |||
11 | clean: { |
||
12 | all: '<%= dirs.destination %>', |
||
13 | css: '<%= dirs.destination %>/css/', |
||
14 | js: '<%= dirs.destination %>/js/' |
||
15 | }, |
||
16 | scsslint: { |
||
17 | development: [ |
||
18 | '<%= dirs.source %>/scss/**/*' |
||
19 | ], |
||
20 | options: { |
||
21 | config: '.scss-lint.yml', |
||
22 | reporterOutput: 'scss-lint-report.xml', |
||
23 | colorizeOutput: true |
||
24 | } |
||
25 | }, |
||
26 | sass: { |
||
27 | production: { |
||
28 | options: { |
||
29 | style: 'compressed' |
||
30 | }, |
||
31 | files: { |
||
32 | '<%= dirs.destination %>/css/style.min.css': '<%= dirs.source %>/scss/all.scss', |
||
33 | '<%= dirs.destination %>/css/legacy.min.css': '<%= dirs.source %>/scss/legacy.scss' |
||
34 | } |
||
35 | }, |
||
36 | development: { |
||
37 | options: { |
||
38 | sourceMap: true, |
||
39 | style: 'expanded' |
||
40 | }, |
||
41 | files: { |
||
42 | '<%= dirs.destination %>/css/style.min.css': '<%= dirs.source %>/scss/all.scss', |
||
43 | '<%= dirs.destination %>/css/legacy.min.css': '<%= dirs.source %>/scss/legacy.scss' |
||
44 | } |
||
45 | }, |
||
46 | options: { |
||
47 | importer: require('grunt-sass-tilde-importer'), |
||
48 | includePaths: [ |
||
49 | '<%= dirs.source %>/scss/' |
||
50 | ] |
||
51 | } |
||
52 | }, |
||
53 | cssmin: { |
||
54 | options: { |
||
55 | shorthandCompacting: false, |
||
56 | roundingPrecision: -1 |
||
57 | }, |
||
58 | target: { |
||
59 | files: { |
||
60 | '<%= dirs.destination %>/css/style.min.css': [ |
||
61 | '<%= dirs.destination %>/css/style.min.css' |
||
62 | ], |
||
63 | '<%= dirs.destination %>/css/legacy.min.css': [ |
||
64 | '<%= dirs.destination %>/css/legacy.min.css' |
||
65 | ] |
||
66 | } |
||
67 | } |
||
68 | }, |
||
69 | uglify: { |
||
70 | production: { |
||
71 | options: { |
||
72 | mangleProperties: false, |
||
73 | reserveDOMProperties: true |
||
74 | }, |
||
75 | files: { |
||
76 | '<%= dirs.destination %>/js/main.js': [ |
||
77 | '<%= dirs.source %>/js/**/*.js' |
||
78 | ] |
||
79 | } |
||
80 | }, |
||
81 | development: { |
||
82 | options: { |
||
83 | sourceMap: true, |
||
84 | beautify: true, |
||
85 | mangle: false, |
||
86 | compress: false |
||
87 | }, |
||
88 | }, |
||
89 | }, |
||
90 | watch: { |
||
91 | css: { |
||
92 | files: [ |
||
93 | '<%= dirs.source %>/scss/**/*.scss' |
||
94 | ], |
||
95 | tasks: [ |
||
96 | 'development:css' |
||
97 | ], |
||
98 | options: { |
||
99 | spawn: false |
||
100 | } |
||
101 | }, |
||
102 | scripts: { |
||
103 | files: [ |
||
104 | '<%= dirs.source %>/js/**/*.js' |
||
105 | ], |
||
106 | tasks: [ |
||
107 | 'development:js' |
||
108 | ] |
||
109 | }, |
||
110 | options: { |
||
111 | atBegin: true |
||
112 | } |
||
113 | } |
||
114 | }); |
||
115 | |||
116 | |||
117 | grunt.registerTask('default', [ |
||
118 | 'build' |
||
119 | ]); |
||
120 | |||
121 | //Builds css&js once for development |
||
122 | grunt.registerTask('build', [ |
||
123 | 'clean:all', |
||
124 | 'uglify', |
||
125 | 'sass:development' |
||
126 | ]); |
||
127 | |||
128 | grunt.registerTask('development:css', [ |
||
129 | 'scsslint:development', |
||
130 | 'clean:css', |
||
131 | 'sass:development' |
||
132 | ]); |
||
133 | |||
134 | grunt.registerTask('development:js', [ |
||
135 | 'clean:js', |
||
136 | 'uglify:development' |
||
137 | ]); |
||
138 | |||
139 | grunt.registerTask('development', [ |
||
140 | 'development:js', |
||
141 | 'development:css' |
||
142 | ]); |
||
143 | |||
144 | //Builds css&js once for production |
||
145 | grunt.registerTask('production', [ |
||
146 | 'clean:all', |
||
147 | 'uglify:production', |
||
148 | 'sass:production', |
||
149 | 'cssmin' |
||
150 | ]); |
||
151 | |||
152 | grunt.task.renameTask('chokidar', 'watch'); |
||
153 | }; |
||
154 |